package com.rs.util;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import com.rs.model.Askfor;
import com.rs.model.Evection;

public class TimerTest {
	public List<String> dateNumber(Askfor aa) throws Exception {
		List<String> ss = new ArrayList<String>();
		 String beginDate = aa.getAsk_ktime()+"";
		 String endDate = aa.getAsk_jtime()+"";
		  
		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		 Calendar cal = Calendar.getInstance();
		 cal.setTime(sdf.parse(beginDate));
		 
		 
		 for (long d = cal.getTimeInMillis(); d <= sdf.parse(endDate).getTime(); d = get_D_Plaus_1(cal)) {
		     ss.add(sdf.format(d));
			 System.out.println(sdf.format(d));
		 }
		return ss;
		  
		 }
	
	public List<String> dateNumber1(Evection aa) throws Exception {
		List<String> ss = new ArrayList<String>();
		 String beginDate = aa.getE_ktime()+"";
		 String endDate = aa.getE_htime()+"";
		  
		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		 Calendar cal = Calendar.getInstance();
		 cal.setTime(sdf.parse(beginDate));
		 
		 
		 for (long d = cal.getTimeInMillis(); d <= sdf.parse(endDate).getTime(); d = get_D_Plaus_1(cal)) {
		     ss.add(sdf.format(d));
			 System.out.println(sdf.format(d));
		 }
		return ss;
		  
		 }
		  
		 public static long get_D_Plaus_1(Calendar c) {
		 c.set(Calendar.DAY_OF_MONTH, c.get(Calendar.DAY_OF_MONTH) + 1);
		 return c.getTimeInMillis();
		 }
}
